<%@ page language="java" pageEncoding="utf-8"
         contentType="text/html;charset=utf-8" %>
<html>

<%@ include file="../../common/jstl.jsp" %>

<head>
</head>

<body>
<div id="addForm" class="mgt40">
    <form action="${ctx }/consultCategory/add" id="editForm" method="post">
        <input type="hidden" name="id" value="${id}"/>
        <div class="">
            <div class="J_formTable l_form_table">
                <table class="not_hightlight">
                    <tr>
                        <td class="l_title w200"><b class="cRed">*</b> 服务类型</td>
                        <td>
                            <div class="J_toolsBar fl">
                                <select name="cmsId" class="t_text w200 ml10">
                                    <c:forEach var="r" items="${map}" varStatus="status">
                                        <c:choose>
                                            <c:when test="${status.index == 0 || consultCategory.cmsId == r.key}">
                                                <option value="${r.key}" selected>${r.value}</option>
                                            </c:when>
                                            <c:otherwise>
                                                <option value="${r.key}">${r.value}</option>
                                            </c:otherwise>
                                        </c:choose>
                                    </c:forEach>
                                </select>
                            </div>
                        </td>
                    </tr>
                    <tr>
                        <td class="l_title "><b class="cRed">*</b> 名称</td>
                        <td>
                            <div class="J_toolsBar fl">
                                <div class="t_text w200 ml10">
                                    <label>
                                        <input type="text" value="${consultCategory.name}" name="name" maxlength="10"/>
                                    </label>
                                </div>
                            </div>
                        </td>
                    </tr>
                    <tr>
                        <td class="l_title "><b class="cRed">*</b> 提示语</td>
                        <td>
                            <div class="J_toolsBar fl">
                                <div class="t_text w200 ml10">
                                    <label>
                                        <input type="text"  value="${consultCategory.text}" name="text" maxlength="50"/>
                                    </label>
                                </div>
                            </div>
                        </td>
                    </tr>
                </table>
            </div>
        </div>
    </form>
</div>
<script type="text/javascript">

    var parentChosen;
    //表单验证
    $(function () {
        $('#editForm').validator({
            ignore: ':hidden',
            fields: {},
            valid: function (form) {
                var laodIdx = layer.load();
                $('#editForm').ajaxSubmit({
                    data: {},
                    traditional: true,
                    success: function (result) {
                        layer.close(laodIdx);
                        if (result.success) {
                            layer.alert('操作成功', function () {
                                window.location.reload();
                            });
                        } else {
                            layer.alert(result.msg);
                        }
                    }
                });
            }
        });
        /*$('input[name="type"]').on('click', function(){
            var val = $('input[name="type"]:checked').val();
            if(val == 'page'){
                $('#parentMenuSelect').show();
            }else{
                $('#parentMenuSelect').hide();
            }
        });*/

    });


</script>
</body>
</html>
